﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ApprovalFlow.Interface
{
    public interface IQueueProvider
    {
        /// <summary>
        /// 将任务工作添加队列
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        Task QueueWork(string id, QueueType queue);

        /// <summary>
        /// 从任务队列的前面获取下一个工作项。
        /// 如果队列为空，则返回NULL
        /// </summary>
        /// <returns></returns>
        Task<string> DequeueWork(QueueType queue, CancellationToken cancellationToken);

        Task Start();
        Task Stop();
    }
    public enum QueueType { Workflow = 0, Event = 1, Index = 2 }
}
